<template>
  <el-card class="box-card">
    <div><span class="add" style="float: right" @click="$router.push('/reqister')">添加用户</span></div>
    <br>
    <br>
<table style="width: 800px;text-align: center;margin-left: 50px">
  <tr style="background-color: #b0e0e688">
    <th>用户名称</th>
    <th>入库管理</th>
    <th>出库管理</th>
    <th>物质处理</th>
    <th>统计查询</th>
    <th>基础信息</th>
    <th>系统管理</th>
    <th>修改</th>
    <th>删除</th>
  </tr>
  <tr v-for="(demouser,dindex) in usering" :key="dindex">
    <td>{{demouser.name}}</td>
    <td><input type="radio"></td>
    <td><input type="radio"></td>
    <td><input type="radio"></td>
    <td><input type="radio"></td>
    <td><input type="radio"></td>
    <td><input type="radio"></td>
    <td><el-button @click="$router.push('/Jurisdiction')">修改</el-button></td>
    <td>
<!--      <el-button @click="deluser(demouser.id)">删除</el-button>-->
      <el-popconfirm
          title="这是一段内容确定删除吗？"

      >
        <el-button slot="reference"  @click="deluser(demouser.id)">删除</el-button>
      </el-popconfirm>
    </td>
  </tr>
</table>
  </el-card>
</template>

<script>
export default {
  name: "demo",
  data(){
    return{
      usering:{}
    }
  },
  created() {

  this.cxuser()
  },
  methods:{

      deluser(id){
        if(confirm("确定删除吗？")){
    this.$axios.get("/api/user/delete/"+id).then(res => {
      console.log(res);
      if(res.data.status===1){
        this.$message.success(res.data.msg)
        this.cxuser()
      }else {
        this.$message.error(res.data.msg)
      }
    })
}
     },
    cxuser(){
      this.$axios.get("/api/user/Jurisdiction").then(res => {
        console.log(res);
        if(res.data.status===1){
          this.usering=res.data.data;

        }
      });

    }
  }
}
</script>

<style scoped>
.box-card{

}
</style>